package com.talent.service.iot.mqtt.handler;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleStateEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName：HeatbeatHandler
 * @Author: hszhou
 * @Date: 2024/12/24 15:39
 * @Description: 心跳时间检测
 */
@ChannelHandler.Sharable
@Component
public class HeartbeatEventTriggered extends ChannelInboundHandlerAdapter {

    private static final Logger logger = LoggerFactory.getLogger(HeartbeatEventTriggered.class);
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {

        if(evt instanceof IdleStateEvent){


            logger.debug("trigger heart event happen");

        }
        super.userEventTriggered(ctx, evt);
    }
}
